package cn.assumejson.springframework.beans.factory.config;

import cn.assumejson.springframework.beans.context.ConfigurableApplicationContext;
import cn.assumejson.springframework.beans.factory.HierarchicalBeanFactory;
import cn.assumejson.springframework.core.util.StringValueResolver;

import java.util.List;

/**
 * 该接口是管理Bean的整个生命周期的模板方法
 * <p>
 * {@link ConfigurableApplicationContext} 则是用来管理beanFactory的模板方法
 * <p>
 * 该接口提供对BeanPOstProcessor的CRUD的模板
 *
 * @Author Mr. Li
 * @Date 2021/11/29 22:49
 * @Version 1.0
 */
public interface ConfigurableBeanFactory extends HierarchicalBeanFactory, SingletonBeanRegistry {

    String SCOPE_SINGLETON = "singleton";

    String SCOPE_PROTOTYPE = "prototype";

    void addBeanPostProcessor(BeanPostProcessor beanPostProcessor);

    /**
     * Add a String resolver for embedded values such as annotation attributes.
     *
     * @param valueResolver 解析器
     */
    void addEmbeddedValueResolver(StringValueResolver valueResolver);

    /**
     *  解析@Value 字段
     * @param value value
     * @return
     */
    String resolveEmbeddedValue(String value);
}
